import 'package:event_bus/event_bus.dart';
import 'package:flutter_layout/base/event_bus_util.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:logger/logger.dart';
import 'package:rxdart/rxdart.dart';

///普通事件
EventBus eventBus = EventBusUtil.getInstance();

///可用于黏性事件
EventBus behaviorBus = EventBus.customController(BehaviorSubject());


///显示Toast消息
void showToast(String message) {
  Fluttertoast.showToast(msg: message, gravity: ToastGravity.CENTER);
}

///log日志打印
var logger = Logger(
  printer: PrettyPrinter(
    printTime: true,
  ),
  filter: LogConsoleFilter(),
);

///判断程序当前的运行环境
bool inProduct() {
  return const bool.fromEnvironment("dart.vm.product");
}

class LogConsoleFilter extends LogFilter {
  @override
  bool shouldLog(LogEvent event) {
    return !inProduct();
  }
}

class Numbers {
  static const size_1 = 1.0;
  static const size_1_7 = 1.7;
  static const size_2 = 2.0;
  static const size_3 = 3.0;
  static const size_4 = 4.0;
  static const size_5 = 5.0;
  static const size_6 = 6.0;
  static const size_7 = 7.0;
  static const size_8 = 8.0;
  static const size_9 = 9.0;
  static const size_10 = 10.0;
  static const size_11 = 11.0;
  static const size_12 = 12.0;
  static const size_13 = 13.0;
  static const size_14 = 14.0;
  static const size_15 = 15.0;
  static const size_16 = 16.0;
  static const size_17 = 17.0;
  static const size_18 = 18.0;
  static const size_19 = 19.0;
  static const size_20 = 20.0;
  static const size_21 = 21.0;
  static const size_22 = 22.0;
  static const size_23 = 23.0;
  static const size_24 = 24.0;
  static const size_25 = 25.0;
  static const size_26 = 26.0;
  static const size_27 = 27.0;
  static const size_28 = 28.0;
  static const size_29 = 29.0;
  static const size_30 = 30.0;
  static const size_40 = 40.0;
  static const size_45 = 45.0;
  static const size_50 = 50.0;
  static const size_56 = 56.0;
  static const size_60 = 60.0;
  static const size_70 = 70.0;
  static const size_80 = 80.0;
  static const size_90 = 90.0;
  static const size_100 = 100.0;
  static const size_150 = 150.0;

  static const int_4 = 4;
  static const int_10 = 10;
  static const int_100 = 100;
  static const int_300 = 300;
  static const int_1000 = 1000;
}
